
package edi.utils;

import edi.entities.DocHistoryEntity;
import edi.entities.DocumentEntity;
import org.joda.time.DateTime;

/**
 *
 * @author Kamil
 */
public class DocumentUtil {
    
    
    public static DocHistoryEntity createSnapshotHistory(DocumentEntity doc, Long auditUsr, String comment){
        DocHistoryEntity docHistory = new DocHistoryEntity();
        docHistory.setCreatedBy(auditUsr);
        docHistory.setCreatedDate(DateTime.now());
        docHistory.setDchComment(comment);
        docHistory.setDchDocContent(doc.getDocContent());
        docHistory.setDchDocDctId(doc.getDocDctId().getDctId());
        docHistory.setDchDocName(doc.getDocName());
        docHistory.setDchDocId(doc.getDocId());
              
        return docHistory;
    }
    
}
